/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com;

import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;

/**
 *
 * @author alrz
 */
public class Dialog extends JDialog implements ActionListener
{

    private JButton cerrar;
    
    public Dialog(String title)
    {
        super();
        this.setTitle(title);
        this.cerrar = new JButton("Cerrar");
        this.cerrar.addActionListener(this);
        this.setLayout(new GridBagLayout());
        this.setIconImage(Icons.LOGO.getImg());
        this.setModal(true);
        this.setResizable(false);
        this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    }
    
    public void setcontenido(JPanel panel)
    {
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 0;
        gbc.gridwidth = 3;
        gbc.gridheight = 1;
        this.add (panel, gbc);

        gbc.gridx = 2;
        gbc.gridy = 1;
        gbc.gridwidth = 1;
        gbc.gridheight = 1;
        this.add (cerrar, gbc);
         
        this.pack();
    }
    
    @Override
    public void actionPerformed(ActionEvent e)
    {
        this.dispose();
    }
}    

